]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Make link.js into a St.Button, delete unused link imports
authorColin Walters <walters@verbum.org>
Wed, 2 Dec 2009 17:13:24 +0000 (12:13 -0500)
committerColin Walters <walters@verbum.org>
Fri, 18 Dec 2009 16:20:05 +0000 (11:20 -0500)
It's actually totally unused at the moment, but a future patch will use it.

https://bugzilla.gnome.org/show_bug.cgi?id=599661

data/theme/gnome-shell.css
js/ui/genericDisplay.js
js/ui/link.js
js/ui/overview.js

index 3c2a6dc488d110a2d172e583370590318b4f61cf..62684f574b13c8f225dbef5dd93bf8124fe596de 100644 (file)
  * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+.shell-link {
+    color: #0000ff;
+    text-decoration: underline;
+}
+
+.shell-link:hover {
+    color: #0000e0;
+}
+
 StScrollBar
 {
   padding: 0px;
index 939d98936036e3a892459f5ce5b73e20fa7372e9..aaa0189068925732272aacc9a987b3ad09aff81c 100644 (file)
@@ -14,7 +14,6 @@ const Shell = imports.gi.Shell;
 const St = imports.gi.St;
 
 const DND = imports.ui.dnd;
-const Link = imports.ui.link;
 const Main = imports.ui.main;
 
 const RedisplayFlags = { NONE: 0,
index fb8ecd85f7d6b1abb773d06ae8007c0a7843cf5b..414df3827785381054886a4997d93bb288ff3ac1 100644 (file)
@@ -3,78 +3,21 @@
 const Clutter = imports.gi.Clutter;
 const Lang = imports.lang;
 const Signals = imports.signals;
+const St = imports.gi.St;
 
-// Link is a clickable link. Right now it just handles properly capturing
-// press and release events and short-circuiting the button handling in
-// ClutterText, but more features like different colors for hover/pressed states
-// or a different mouse cursor could be implemented.
-//
-// The properties passed in are forwarded to the Clutter.Text() constructor,
-// so can include, 'text', 'font_name', etc.
 function Link(props) {
     this._init(props);
 }
 
 Link.prototype = {
     _init : function(props) {
-       let realProps = { reactive: true };
+        let realProps = { reactive: true,
+                          style_class: 'shell-link' };
         // The user can pass in reactive: false to override the above and get
         // a non-reactive link (a link to the current page, perhaps)
-       Lang.copyProperties(props, realProps);
+        Lang.copyProperties(props, realProps);
 
-       this.actor = new Clutter.Text(realProps);
-       this.actor._delegate = this;
-       this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
-       this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
-       this.actor.connect('enter-event', Lang.bind(this, this._onEnter));
-       this.actor.connect('leave-event', Lang.bind(this, this._onLeave));
-
-       this._buttonDown = false;
-       this._havePointer = false;
-    },
-
-    // Update the text of the link
-    setText : function(text) {
-       this.actor.text = text;
-    },
-
-    // We want to react on buttonDown, but if we override button-release-event for
-    // ClutterText, but not button-press-event, we get a stuck grab. Tracking
-    // buttonDown and doing the grab isn't really necessary, but doing it makes
-    // the behavior perfectly correct if the user clicks on one actor, drags
-    // to another and releases - that should not trigger either actor.
-    _onButtonPress : function(actor, event) {
-       this._buttonDown = true;
-       this._havePointer = true; // Hack to work around poor enter/leave tracking in Clutter
-       Clutter.grab_pointer(actor);
-
-       return true;
-    },
-
-    _onButtonRelease : function(actor, event) {
-       if (this._buttonDown) {
-           this._buttonDown = false;
-           Clutter.ungrab_pointer(actor);
-
-           if (this._havePointer)
-               this.emit('clicked');
-       }
-
-       return true;
-    },
-
-    _onEnter : function(actor, event) {
-       if (event.get_source() == actor)
-           this._havePointer = true;
-
-        return false;
-    },
-
-    _onLeave : function(actor, event) {
-       if (event.get_source() == actor)
-           this._havePointer = false;
-
-        return false;
+        this.actor = new St.Button(realProps);
     }
 };
 
index a9697fff0538414f547ee632de3bb48b5b9834e3..43ff6d75df4bd45c78a4ab7479d5fc1a9ca75aff 100644 (file)
@@ -12,7 +12,6 @@ const Lang = imports.lang;
 const AppDisplay = imports.ui.appDisplay;
 const DocDisplay = imports.ui.docDisplay;
 const GenericDisplay = imports.ui.genericDisplay;
-const Link = imports.ui.link;
 const Main = imports.ui.main;
 const Panel = imports.ui.panel;
 const Dash = imports.ui.dash;